/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Sik
 */
@Entity
@Table(name = "saison")
@XmlRootElement
@NamedQueries(
{
    @NamedQuery(name = "Saison.findAll", query = "SELECT s FROM Saison s"),
    @NamedQuery(name = "Saison.findByIdSaison", query = "SELECT s FROM Saison s WHERE s.idSaison = :idSaison"),
    @NamedQuery(name = "Saison.findByAnnee", query = "SELECT s FROM Saison s WHERE s.annee = :annee"),
    @NamedQuery(name = "Saison.findByDateDebut", query = "SELECT s FROM Saison s WHERE s.dateDebut = :dateDebut")
})
public class Saison implements Serializable
{
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idSaison")
    private Integer idSaison;
    @Column(name = "annee")
    @Temporal(TemporalType.DATE)
    private Date annee;
    @Column(name = "dateDebut")
    @Temporal(TemporalType.DATE)
    private Date dateDebut;
    @ManyToMany(mappedBy = "saisonList")
    private List<Adherent> adherentList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "saisonidSaison")
    private List<Transaction> transactionList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "saisonidSaison")
    private List<Deplacement> deplacementList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "saisonidSaison")
    private List<Competition> competitionList;

    public Saison()
    {
    }

    public Saison(Integer idSaison)
    {
        this.idSaison = idSaison;
    }

    public Integer getIdSaison()
    {
        return idSaison;
    }

    public void setIdSaison(Integer idSaison)
    {
        this.idSaison = idSaison;
    }

    public Date getAnnee()
    {
        return annee;
    }

    public void setAnnee(Date annee)
    {
        this.annee = annee;
    }

    public Date getDateDebut()
    {
        return dateDebut;
    }

    public void setDateDebut(Date dateDebut)
    {
        this.dateDebut = dateDebut;
    }

    @XmlTransient
    public List<Adherent> getAdherentList()
    {
        return adherentList;
    }

    public void setAdherentList(List<Adherent> adherentList)
    {
        this.adherentList = adherentList;
    }

    @XmlTransient
    public List<Transaction> getTransactionList()
    {
        return transactionList;
    }

    public void setTransactionList(List<Transaction> transactionList)
    {
        this.transactionList = transactionList;
    }

    @XmlTransient
    public List<Deplacement> getDeplacementList()
    {
        return deplacementList;
    }

    public void setDeplacementList(List<Deplacement> deplacementList)
    {
        this.deplacementList = deplacementList;
    }

    @XmlTransient
    public List<Competition> getCompetitionList()
    {
        return competitionList;
    }

    public void setCompetitionList(List<Competition> competitionList)
    {
        this.competitionList = competitionList;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (idSaison != null ? idSaison.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Saison))
        {
            return false;
        }
        Saison other = (Saison) object;
        if ((this.idSaison == null && other.idSaison != null) || (this.idSaison != null && !this.idSaison.equals(other.idSaison)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "Model.Saison[ idSaison=" + idSaison + " ]";
    }
    
}
